﻿
namespace RestaurantBooker.Web.Services
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data.Linq;
    using System.Linq;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using Microsoft.ServiceModel.DomainServices.LinqToSql;
    using RestaurantBooker.Web.Data;


    // Implements application logic using the SQLBookerDataClassesDataContext context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public partial class RestaurantBookerDomainService : LinqToSqlDomainService<SQLBookerDataClassesDataContext>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Booker> GetBookers()
        {
            return this.DataContext.Bookers;
        }

        public void InsertBooker(Booker booker)
        {
            this.DataContext.Bookers.InsertOnSubmit(booker);
        }

        public void UpdateBooker(Booker currentBooker)
        {
            this.DataContext.Bookers.Attach(currentBooker, this.ChangeSet.GetOriginal(currentBooker));
        }

        public void DeleteBooker(Booker booker)
        {
            this.DataContext.Bookers.Attach(booker);
            this.DataContext.Bookers.DeleteOnSubmit(booker);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Customer> GetCustomers()
        {
            return this.DataContext.Customers;
        }

        public void InsertCustomer(Customer customer)
        {
            this.DataContext.Customers.InsertOnSubmit(customer);
        }

        public void UpdateCustomer(Customer currentCustomer)
        {
            this.DataContext.Customers.Attach(currentCustomer, this.ChangeSet.GetOriginal(currentCustomer));
        }

        public void DeleteCustomer(Customer customer)
        {
            this.DataContext.Customers.Attach(customer);
            this.DataContext.Customers.DeleteOnSubmit(customer);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Dish> GetDishes()
        {
            return this.DataContext.Dishes;
        }

        public void InsertDish(Dish dish)
        {
            this.DataContext.Dishes.InsertOnSubmit(dish);
        }

        public void UpdateDish(Dish currentDish)
        {
            this.DataContext.Dishes.Attach(currentDish, this.ChangeSet.GetOriginal(currentDish));
        }

        public void DeleteDish(Dish dish)
        {
            this.DataContext.Dishes.Attach(dish);
            this.DataContext.Dishes.DeleteOnSubmit(dish);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Order> GetOrders()
        {
            return this.DataContext.Orders;
        }

        public void InsertOrder(Order order)
        {
            this.DataContext.Orders.InsertOnSubmit(order);
        }

        public void UpdateOrder(Order currentOrder)
        {
            this.DataContext.Orders.Attach(currentOrder, this.ChangeSet.GetOriginal(currentOrder));
        }

        public void DeleteOrder(Order order)
        {
            this.DataContext.Orders.Attach(order);
            this.DataContext.Orders.DeleteOnSubmit(order);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Restaurant> GetRestaurants()
        {
            return this.DataContext.Restaurants;
        }

        public void InsertRestaurant(Restaurant restaurant)
        {
            this.DataContext.Restaurants.InsertOnSubmit(restaurant);
        }

        public void UpdateRestaurant(Restaurant currentRestaurant)
        {
            this.DataContext.Restaurants.Attach(currentRestaurant, this.ChangeSet.GetOriginal(currentRestaurant));
        }

        public void DeleteRestaurant(Restaurant restaurant)
        {
            this.DataContext.Restaurants.Attach(restaurant);
            this.DataContext.Restaurants.DeleteOnSubmit(restaurant);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Room> GetRooms()
        {
            return this.DataContext.Rooms;
        }

        public void InsertRoom(Room room)
        {
            this.DataContext.Rooms.InsertOnSubmit(room);
        }

        public void UpdateRoom(Room currentRoom)
        {
            this.DataContext.Rooms.Attach(currentRoom, this.ChangeSet.GetOriginal(currentRoom));
        }

        public void DeleteRoom(Room room)
        {
            this.DataContext.Rooms.Attach(room);
            this.DataContext.Rooms.DeleteOnSubmit(room);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Room_Table> GetRoom_Tables()
        {
            return this.DataContext.Room_Tables;
        }

        public void InsertRoom_Table(Room_Table room_Table)
        {
            this.DataContext.Room_Tables.InsertOnSubmit(room_Table);
        }

        public void UpdateRoom_Table(Room_Table currentRoom_Table)
        {
            this.DataContext.Room_Tables.Attach(currentRoom_Table, this.ChangeSet.GetOriginal(currentRoom_Table));
        }

        public void DeleteRoom_Table(Room_Table room_Table)
        {
            this.DataContext.Room_Tables.Attach(room_Table);
            this.DataContext.Room_Tables.DeleteOnSubmit(room_Table);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        public IQueryable<Table_Place> GetTable_Places()
        {
            return this.DataContext.Table_Places;
        }

        public void InsertTable_Place(Table_Place table_Place)
        {
            this.DataContext.Table_Places.InsertOnSubmit(table_Place);
        }

        public void UpdateTable_Place(Table_Place currentTable_Place)
        {
            this.DataContext.Table_Places.Attach(currentTable_Place, this.ChangeSet.GetOriginal(currentTable_Place));
        }

        public void DeleteTable_Place(Table_Place table_Place)
        {
            this.DataContext.Table_Places.Attach(table_Place);
            this.DataContext.Table_Places.DeleteOnSubmit(table_Place);
        }
    }
}


